package com.hsylient.javase.chapter05;

import lombok.SneakyThrows;
import org.junit.Test;

import java.io.FileOutputStream;
import java.io.PrintStream;

public class K_MyPrintStream {

    /*
        标准的输出流，输出到控制台上
     */
    @Test
    public void testPrint() {
        System.out.println("hsylient");
        PrintStream out = System.out;
        out.println("面对疾风吧！！！！！");
    }

    /**
     * 改变标准输出流的输出方向
     */
    @Test
    @SneakyThrows
    public void change() {
        System.setOut(new PrintStream(new FileOutputStream("a.txt")));
        System.out.println("hsylient.txt");
    }
}
